
package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import com.ysd.entity.ChanPinXiangQing;
import com.ysd.util.DBManager;

public class ChanPinXiangQingNeiRongDaoimpl {
	/**
	 * 通过fenleiId查询产品详情的数据
	 * @param id
	 * @return
	 */
		public ArrayList<ChanPinXiangQing> getChanPinXiangQingNeiRong(int id){
			ArrayList<ChanPinXiangQing> list=new ArrayList<ChanPinXiangQing>();
			Connection conn=DBManager.getConnection();
			Statement st=null;
			ResultSet rs=null;
			try {
				 st=conn.createStatement();
				String sql="SELECT * FROM chanpinxiangqing WHERE fenleiId="+id;
				 rs=st.executeQuery(sql);
				while(rs.next()) {
					ChanPinXiangQing cpxq=new ChanPinXiangQing(rs.getInt("chanPingId"), rs.getString("chanPinName"), rs.getInt("fenleiId"), rs.getString("imgs"));
					list.add(cpxq);
				}	
				return list;
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}finally {
				DBManager.closeAll(conn, st, rs);
			}
			
			
		}
}
